package com.example.commentserver.manager;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.commentserver.entity.Talk;
import com.example.commentserver.mapper.TalkMapper;
import com.example.commentserver.params.PageTalkParams;
import com.example.commentserver.params.TalkParams;
import com.example.commentserver.vo.TalkListVO;
import com.example.commentserver.vo.TalkVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

@Service
public class TalkManager {
    @Autowired
    private TalkMapper talkMapper;
    public void insertTalk(Talk talk){
        talkMapper.insert(talk);
    }
    public void deleteTalk(String id){
        talkMapper.deleteById(id);
    }

    public void updateTalk(Talk talk, QueryWrapper queryWrapper){
        talkMapper.update(talk, queryWrapper);
    }

    public List<TalkVO> talkDetail(TalkParams talkParams){
        return talkMapper.talkDetail(talkParams);
    }

    public List<TalkListVO> talkList(PageTalkParams pageTalkParams) {
        return talkMapper.talkList(pageTalkParams);
    }
}
